import TYPES from './actionType';

export const setUserData = (data) => ({
    type: TYPES.SET_USER,
    payload: data
});

export const setCategory = (data) => ({
    type: TYPES.SET_CATEGORY,
    payload: data
});

export const setContent = (data) => ({
    type: TYPES.SET_CONTENT,
    payload: data
});

//模拟异步redux传输数据
export const setAsncContent = () => {
  return (dispatch) => {
    setTimeout(()=>{
      const response = {
        name: "标题",
        pid: 2
      }
      console.log('执行异步保存redux')
      dispatch({
        type: TYPES.SET_CATEGORY,
        payload: response
      })
    },100)
  }
}